package service.impl;

import entity.News;
import dao.NewsDao;
import service.NewsService;
import dao.impl.SimpleDaoFactory;

/**
 * 新闻模块业务类
 */
public class NewsServiceImpl implements NewsService {
    //实例化所依赖的NewsDao对象
//    private NewsDao dao=new NewsDaoImpl();
    private NewsDao daoo= SimpleDaoFactory.getInstance("mysql");
    private NewsDao dao;
    public void setDao(NewsDao dao) {
        this.dao = dao;
    }
    @Override
    public void addNews(News news) {
        //调用NewsDao的方法保存新闻信息
        dao.save(news);
    }
}
